#ifndef STDINT_H
#define STDINT_H

#include <yonex/bits.h>
#include <stddef.h>
#include <yonex/limits.h>

#if __WORDSIZE == 64
# ifndef __intptr_t_defined
typedef long int  intptr_t;
#  define __intptr_t_defined
# endif
typedef unsigned long int uintptr_t;
#else
# ifndef __intptr_t_defined
typedef int   intptr_t;
#  define __intptr_t_defined
# endif
typedef unsigned int  uintptr_t;
#endif

typedef __intmax_t		intmax_t;
typedef __uintmax_t		uintmax_t;

#define INT8_MIN   (-1-0x7f)
#define INT16_MIN  (-1-0x7fff)
#define INT32_MIN  (-1-0x7fffffff)
#define INT64_MIN  (-1-0x7fffffffffffffff)

#define INT8_MAX   (0x7f)
#define INT16_MAX  (0x7fff)
#define INT32_MAX  (0x7fffffff)
#define INT64_MAX  (0x7fffffffffffffff)

#define UINT8_MAX  (0xff)
#define UINT16_MAX (0xffff)
#define UINT32_MAX (0xffffffffu)
#define UINT64_MAX (0xffffffffffffffffu)

#define INTMAX_MIN  INT64_MIN
#define INTMAX_MAX  INT64_MAX
#define UINTMAX_MAX UINT64_MAX

#endif
